#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

class Solution
{
 public:
  int add(int num1, int num2)
  {
    while (num2 != 0)
    {
      int sum = num1 ^ num2;           // 不进位的加法
      int carry = (num1 & num2) << 1;  // 进位
      num1 = sum;
      num2 = carry;  // num2每次左移末尾有k+1个零
    }
    return num1;
  }
};
